home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / clipper / nftroff.zip / 2.tr < prev    next >
Text File  |  1991-11-21  |  16KB  |  1,064 lines

  1. .de }n
  2. .bp
  3. .sp .5i
  4. ..
  5. .wh -.8i }n
  6. .sp .5i
  7. .po -.4i
  8. .ll 7.5i
  9. .ps 9
  10. .vs 9
  11. .in 0i
  12. .ta 1.63265i
  13. .sp 2
  14. .ne 20
  15. .ps +3
  16. .vs +3
  17. FT_BYT2BIT()    Convert byte to string of 1\'s and 0\'s
  18. .br
  19. .ta
  20. .in 0.08i
  21. .ps -3
  22. .vs -3
  23. .sp 2
  24. \fBFT_BYT2BIT()
  25. Convert byte to string of 1\'s and 0\'s
  26. .in 0i
  27. .br
  28. \l'6.24i'
  29. .br
  30. .sp
  31. .in 0.08i
  32. \fBSyntax
  33. .sp
  34. .in 0.4i
  35. \fBFT_BYT2BIT( <cByte> ) -> cBitPattern
  36. .sp
  37. .in 0.08i
  38. \fBArguments
  39. .sp
  40. .in 0.4i
  41. \fB<cByte>\fR is the byte to convert\.
  42. .sp
  43. .in 0.08i
  44. \fBReturns
  45. .sp
  46. .in 0.4i
  47. 9-character string, consisting of 1\'s and 0\'s, representing bits 0
  48. through 7 of parameter byte, with space between bits 3 and 4\.  Returns
  49. NIL if parameters are faulty\.
  50. .sp
  51. .in 0.08i
  52. \fBDescription
  53. .sp
  54. .in 0.4i
  55. Can be used to show results of bit manipulation, both before and after\.
  56. Binary representation follows right-to-left convention of bit position
  57. numbering, 0 through 7\.  Space between high and low nibbles for clarity
  58. and easy comparison to hexadecimal notation\.
  59. .sp
  60. This function is presented to illustrate that bit-wise operations
  61. are possible with Clipper code\.  For greater speed, write \.C or
  62. \.ASM versions and use the Clipper Extend system\.
  63. .sp
  64. .in 0.08i
  65. \fBExamples
  66. .sp
  67. .in 0.4i
  68. These three code lines perform a bitwise AND on bytes with values of
  69. CHR(20) and CHR(36), and deliver the result as a string in binary (bit)
  70. format\.
  71. .sp
  72. .in 0.8i
  73. .ta 2.4i
  74. ? FT_BYT2BIT(CHR(20))    // byte1: \'0001 0100\'
  75. .br
  76. .ta
  77. .ta 2.4i
  78. ? FT_BYT2BIT(CHR(36))    // byte2: \'0010 0100\'
  79. .br
  80. .ta
  81. .sp
  82. ? FT_BYT2BIT(FT_BYTEAND(CHR(20), CHR(36)))
  83. .in 2.32i
  84. // result: \'0000 0100\'
  85. .sp
  86. .in 0.4i
  87. For a demonstration of Clipper bit manipulations, compile and
  88. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  89. .sp
  90. .in 0.08i
  91. \fBSource:\fR BYT2BIT\.PRG
  92. .sp
  93. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  94. .in 0i
  95. .sp
  96. .in 1.5i
  97. .ti -1.5i
  98. .ta 1.5i
  99. .ft B
  100. See Also:    
  101. .ft R
  102. FT_BYT2HEX()
  103. .ta 1.63265i
  104. .in 0i
  105. .sp 2
  106. .ne 20
  107. .ps +3
  108. .vs +3
  109. FT_BYT2HEX()    Convert byte to hexadecimal version of its binary value
  110. .br
  111. .ta
  112. .in 0.08i
  113. .ps -3
  114. .vs -3
  115. .sp 2
  116. \fBFT_BYT2HEX()
  117. Convert byte to hexadecimal version of its binary value
  118. .in 0i
  119. .br
  120. \l'6.24i'
  121. .br
  122. .sp
  123. .in 0.08i
  124. \fBSyntax
  125. .sp
  126. .in 0.4i
  127. \fBFT_BYT2HEX( cByte ) -> cHexValue
  128. .sp
  129. .in 0.08i
  130. \fBArguments
  131. .sp
  132. .in 0.4i
  133. \fB<cByte>\fR is the byte to convert\.
  134. .sp
  135. .in 0.08i
  136. \fBReturns
  137. .sp
  138. .in 0.4i
  139. Three-character string, consisting of two digits of hexadecimal
  140. notation and letter \'h\' to signify hex\.  Returns NIL if parameters are
  141. faulty\.
  142. .sp
  143. .in 0.08i
  144. \fBDescription
  145. .sp
  146. .in 0.4i
  147. Can be used to show results of bit manipulation, both before and after\.
  148. .sp
  149. This function is presented to illustrate that bit-wise operations
  150. are possible with Clipper code\.  For greater speed, write \.C or
  151. \.ASM versions and use the Clipper Extend system\.
  152. .sp
  153. .in 0.08i
  154. \fBExamples
  155. .sp
  156. .in 0.4i
  157. These three code lines perform a bitwise AND on bytes with values of
  158. CHR(20) and CHR(36), and deliver the result as a string in hexadecimal
  159. format, using \'h\' to signify hexadecimal\.
  160. .sp
  161. .in 0.8i
  162. .ta 2.4i
  163. ? FT_BYT2HEX(CHR(20))    // byte1: \'14h\'
  164. .br
  165. .ta
  166. .ta 2.4i
  167. ? FT_BYT2HEX(CHR(36))    // byte2: \'24h\'
  168. .br
  169. .ta
  170. .sp
  171. ? FT_BYT2HEX(FT_BYTEAND(CHR(20), CHR(36)))
  172. .in 2.32i
  173. // result: \'04h\'
  174. .sp
  175. .in 0.4i
  176. For a demonstration of Clipper bit manipulations, compile and
  177. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  178. .sp
  179. .in 0.08i
  180. \fBSource:\fR BYT2HEX\.PRG
  181. .sp
  182. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  183. .in 0i
  184. .sp
  185. .in 1.5i
  186. .ti -1.5i
  187. .ta 1.5i
  188. .ft B
  189. See Also:    
  190. .ft R
  191. FT_BYT2BIT()
  192. .ta 1.63265i
  193. .in 0i
  194. .sp 2
  195. .ne 20
  196. .ps +3
  197. .vs +3
  198. FT_D2E()    Convert decimal to scientific notation
  199. .br
  200. .ta
  201. .in 0.08i
  202. .ps -3
  203. .vs -3
  204. .sp 2
  205. \fBFT_D2E()
  206. Convert decimal to scientific notation
  207. .in 0i
  208. .br
  209. \l'6.24i'
  210. .br
  211. .sp
  212. .in 0.08i
  213. \fBSyntax
  214. .sp
  215. .in 0.96i
  216. .ta 2.56i
  217. \fBFT_D2E( <nDec>, <nPrecision> )    -> <cNumE>
  218. .br
  219. .ta
  220. .sp
  221. .in 0.08i
  222. \fBArguments
  223. .sp
  224. .in 1.28i
  225. .ta 1.2i
  226. \fB<nDec>\fR    Decimal number to convert
  227. .br
  228. .ta
  229. .sp
  230. .ta 1.2i
  231. \fB<nPrecision>\fR    Number of decimal places in result\.
  232. .br
  233. .ta
  234. .in 1.68i
  235. Defaults to 6 decimal places\.
  236. .sp
  237. .in 0.08i
  238. \fBReturns
  239. .sp
  240. .in 1.28i
  241. .ta 1.2i
  242. <cNumE>    A string representing a number in
  243. .br
  244. .ta
  245. .in 1.68i
  246. scientific notation
  247. .sp
  248. .in 0.08i
  249. \fBDescription
  250. .sp
  251. .in 1.28i
  252. Given a decimal number and the desired precision,
  253. a string representing the equivalent in scientific
  254. notation is returned\.
  255. .sp
  256. .in 0.08i
  257. \fBExamples
  258. .sp
  259. .in 1.28i
  260. ? FT_D2E( 12\.345, 2 )
  261. .in 1.44i
  262. -> 1\.23E1
  263. .sp
  264. .in 1.28i
  265. ? FT_D2E( -12\.345, 3 )
  266. .in 1.44i
  267. -> -1\.235E1
  268. .sp
  269. .in 1.28i
  270. ? FT_D2E( 0\.00000543, 2 )
  271. .in 1.44i
  272. -> 5\.43E-6
  273. .sp
  274. .in 0.08i
  275. \fBSource:\fR D2E\.PRG
  276. .sp
  277. \fBAuthor:\fR Gary Baren
  278. .in 0i
  279. .sp
  280. .in 1.5i
  281. .ti -1.5i
  282. .ta 1.5i
  283. .ft B
  284. See Also:    
  285. .ft R
  286. FT_E2D()
  287. .ta 1.63265i
  288. .in 0i
  289. .sp 2
  290. .ne 20
  291. .ps +3
  292. .vs +3
  293. FT_DEC2BIN()    Convert decimal to binary
  294. .br
  295. .ta
  296. .in 0.08i
  297. .ps -3
  298. .vs -3
  299. .sp 2
  300. \fBFT_DEC2BIN()
  301. Convert decimal to binary
  302. .in 0i
  303. .br
  304. \l'6.24i'
  305. .br
  306. .sp
  307. .in 0.08i
  308. \fBSyntax
  309. .sp
  310. .in 0.4i
  311. \fBFT_DEC2BIN( <nNum> ) -> cBinaryNumber
  312. .sp
  313. .in 0.08i
  314. \fBArguments
  315. .sp
  316. .in 0.4i
  317. \fB<nNum>\fR is the numeric expression to be converted\.
  318. .sp
  319. .in 0.08i
  320. \fBReturns
  321. .sp
  322. .in 0.4i
  323. A character string representing <nNum> in binary format\.
  324. .sp
  325. .in 0.08i
  326. \fBDescription
  327. .sp
  328. .in 0.4i
  329. This function can be used in conjunction with any bit-wise
  330. operations\.
  331. .sp
  332. .in 0.08i
  333. \fBExamples
  334. .sp
  335. .in 0.4i
  336. .ta 2.48i
  337. QOut( FT_DEC2BIN(255) )    // "11111111"
  338. .br
  339. .ta
  340. .ta 2.48i
  341. QOut( FT_DEC2BIN(2) )    // "00000010"
  342. .br
  343. .ta
  344. .sp
  345. .in 0.08i
  346. \fBSource:\fR DECTOBIN\.PRG
  347. .sp
  348. \fBAuthor:\fR Greg Lief
  349. .in 0i
  350. .ta 1.63265i
  351. .sp 2
  352. .ne 20
  353. .ps +3
  354. .vs +3
  355. FT_E2D()    Convert scientific notation string to a decimal
  356. .br
  357. .ta
  358. .in 0.08i
  359. .ps -3
  360. .vs -3
  361. .sp 2
  362. \fBFT_E2D()
  363. Convert scientific notation string to a decimal
  364. .in 0i
  365. .br
  366. \l'6.24i'
  367. .br
  368. .sp
  369. .in 0.08i
  370. \fBSyntax
  371. .sp
  372. .in 0.96i
  373. .ta 1.52i
  374. \fBFT_E2D( <cNumE> )    -> <nDec>
  375. .br
  376. .ta
  377. .sp
  378. .in 0.08i
  379. \fBArguments
  380. .sp
  381. .in 1.28i
  382. .ta 0.8i
  383. \fB<cNumE>\fR    Scientific notation string to convert
  384. .br
  385. .ta
  386. .sp
  387. .in 0.08i
  388. \fBReturns
  389. .sp
  390. .in 1.28i
  391. .ta 0.8i
  392. <nDec>    Decimal number
  393. .br
  394. .ta
  395. .sp
  396. .in 0.08i
  397. \fBDescription
  398. .sp
  399. .in 1.28i
  400. .ta 2.4i
  401. Given a string in the format    x\.yEz, the decimal
  402. .br
  403. .ta
  404. equivalent is returned\.
  405. .sp
  406. .in 0.08i
  407. \fBExamples
  408. .sp
  409. .in 1.28i
  410. ? FT_E2D( "1\.23E1" )
  411. .in 1.44i
  412. -> 12\.3
  413. .sp
  414. .in 1.28i
  415. ? FT_E2D( "-1\.235E1" )
  416. .in 1.44i
  417. -> -12\.35
  418. .sp
  419. .in 1.28i
  420. ? ft_d2e( "5\.43E-6" )
  421. .in 1.44i
  422. -> 0\.0000543
  423. .sp
  424. .in 0.08i
  425. \fBSource:\fR E2D\.PRG
  426. .sp
  427. \fBAuthor:\fR Gary Baren
  428. .in 0i
  429. .sp
  430. .in 1.5i
  431. .ti -1.5i
  432. .ta 1.5i
  433. .ft B
  434. See Also:    
  435. .ft R
  436. FT_D2E()
  437. .ta 1.63265i
  438. .in 0i
  439. .sp 2
  440. .ne 20
  441. .ps +3
  442. .vs +3
  443. FT_ESCCODE()    Convert Lotus style escape codes
  444. .br
  445. .ta
  446. .in 0.08i
  447. .ps -3
  448. .vs -3
  449. .sp 2
  450. \fBFT_ESCCODE()
  451. Convert Lotus style escape codes
  452. .in 0i
  453. .br
  454. \l'6.24i'
  455. .br
  456. .sp
  457. .in 0.08i
  458. \fBSyntax
  459. .sp
  460. .in 0.4i
  461. .ta 1.92i
  462. \fBFT_ESCCODE( <cASCII> )    -> <cPrinterFormat>
  463. .br
  464. .ta
  465. .sp
  466. .in 0.08i
  467. \fBArguments
  468. .sp
  469. .in 0.4i
  470. \fB<cASCII>\fR is the ASCII representation of the printer control
  471. .in 1.28i
  472. codes in Lotus 123 format (e\.g\. "\\027E" for Chr(27)+"E")
  473. .sp
  474. .br
  475. "\\nnn" will be converted to Chr(nnn)
  476. .br
  477. "\\\\" will be converted to "\\"
  478. .sp
  479. .in 0.08i
  480. \fBReturns
  481. .sp
  482. .in 0.4i
  483. The binary version of an ASCII coded printer setup string\.
  484. .sp
  485. .in 0.08i
  486. \fBDescription
  487. .sp
  488. .in 0.4i
  489. This function is useful for allowing the user to enter printer
  490. control codes in Lotus-style ASCII format, and then having
  491. this function convert that code to the format that the printer
  492. needs to receive\.
  493. .sp
  494. .in 0.08i
  495. \fBExamples
  496. .sp
  497. .in 0.4i
  498. .ta 2i
  499. cSetup = "\\015"    // default = Epson compressed print
  500. .br
  501. .ta
  502. .ta 2i
  503. UserInput( @cSetup )    // Let user modify setup code
  504. .br
  505. .ta
  506. .ta 2i
  507. SET DEVICE TO PRINT    // get ready to print
  508. .br
  509. .ta
  510. .ta 2i
  511. ?? FT_ESCCODE( cSetup )    // Output the converted code
  512. .br
  513. .ta
  514. .sp
  515. .in 0.08i
  516. \fBSource:\fR PRTESC\.PRG
  517. .sp
  518. \fBAuthor:\fR Steven Tyrakowski
  519. .in 0i
  520. .ta 1.63265i
  521. .sp 2
  522. .ne 20
  523. .ps +3
  524. .vs +3
  525. FT_HEX2DEC()    Convert a hex number to decimal
  526. .br
  527. .ta
  528. .in 0.08i
  529. .ps -3
  530. .vs -3
  531. .sp 2
  532. \fBFT_HEX2DEC()
  533. Convert a hex number to decimal
  534. .in 0i
  535. .br
  536. \l'6.24i'
  537. .br
  538. .sp
  539. .in 0.08i
  540. \fBSyntax
  541. .sp
  542. .in 0.32i
  543. \fBFT_HEX2DEC( <cHexNum> ) -> nDecNum
  544. .sp
  545. .in 0.08i
  546. \fBArguments
  547. .sp
  548. .in 0.32i
  549. \fB<cHexNum>\fR is a character string representing a hex number\.
  550. .sp
  551. .in 0.08i
  552. \fBReturns
  553. .sp
  554. .in 0.32i
  555. A decimal number\.
  556. .sp